﻿using System.Collections.Generic;
using Wicresoft.RDW.Interface;
using Wicresoft.RDW.Model;
using System.Linq;

namespace Wicresoft.RDW.Presentation
{
    public class AnnouncementPresent : BasePresent<Announcement, IAnnouncement>
    {
        public static List<Announcement> GetByLanguage(string language)
        {
            return present.GetList(p => p.Language.Contains(language));
        }
        public static List<Announcement> GetTopByTime(string language,int count)
        {
            var announcement = present.GetList();
            int announcementcount = announcement.Count;
            count = count > announcementcount ? announcementcount : count;
            return present.GetList(p => p.Language.Contains(language)).OrderByDescending(p => p.CreateTime).Take(count).ToList();
        }
    }
}
